Skip to content

Conversation

@dpaoliello
Copy link
Contributor

After #109774 MSVC is failing to build LLVM with the error:

llvm\lib\Target\RISCV\RISCVInstrInfo.cpp(782): warning C4018: '<': signed/unsigned mismatch

Fix is ensure that the RHS is an unsigned integer.

@llvmbot
Copy link
Member

llvmbot commented Sep 27, 2024

@llvm/pr-subscribers-backend-risc-v

Author: Daniel Paoliello (dpaoliello)

Changes

After #109774 MSVC is failing to build LLVM with the error:

llvm\lib\Target\RISCV\RISCVInstrInfo.cpp(782): warning C4018: '&lt;': signed/unsigned mismatch

Fix is ensure that the RHS is an unsigned integer.


Full diff: https://github.com/llvm/llvm-project/pull/110342.diff

1 Files Affected:

  • (modified) llvm/lib/Target/RISCV/RISCVInstrInfo.cpp (+1-1)
diff --git a/llvm/lib/Target/RISCV/RISCVInstrInfo.cpp b/llvm/lib/Target/RISCV/RISCVInstrInfo.cpp
index f0295d289ed86a..529944044f02d2 100644
--- a/llvm/lib/Target/RISCV/RISCVInstrInfo.cpp
+++ b/llvm/lib/Target/RISCV/RISCVInstrInfo.cpp
@@ -779,7 +779,7 @@ MachineInstr *RISCVInstrInfo::foldMemoryOperandImpl(
     if (RISCV::getRVVMCOpcode(MI.getOpcode()) == RISCV::VMV_X_S) {
       unsigned Log2SEW =
           MI.getOperand(RISCVII::getSEWOpNum(MI.getDesc())).getImm();
-      if (STI.getXLen() < (1 << Log2SEW))
+      if (STI.getXLen() < (1U << Log2SEW))
         return nullptr;
       switch (Log2SEW) {
       case 3:

Copy link
Member

@kito-cheng kito-cheng left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

@lukel97
Copy link
Contributor

lukel97 commented Sep 29, 2024

Thanks for fixing this. What version of MSVC was this showing up with? This seemed to slip past the windows pre-merge CI: https://buildkite.com/llvm-project/github-pull-requests/builds/103512#0192235b-a71e-4dc7-8b7b-6ba3b185f6ac

@dpaoliello
Copy link
Contributor Author

Looks like CI is running VS 2019:

The C compiler identification is MSVC 19.29.30154.0

And I'm using VS 2022:

> cl --version
Microsoft (R) C/C++ Optimizing Compiler Version 19.41.34120 for x64

@dpaoliello dpaoliello merged commit ce6369e into llvm:main Sep 30, 2024
6 checks passed
@dpaoliello dpaoliello deleted the riscvmsvc branch September 30, 2024 17:40
steven-studio pushed a commit to steven-studio/llvm-project that referenced this pull request Sep 11, 2025
After llvm#109774 MSVC is failing to build LLVM with the error:

```
llvm\lib\Target\RISCV\RISCVInstrInfo.cpp(782): warning C4018: '<': signed/unsigned mismatch
```

Fix is ensure that the RHS is an unsigned integer.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants